<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="_fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">

    <link href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css" rel="stylesheet">
    <link rel="stylesheet" href="../static/css/animate.css">
    <link rel="stylesheet" href="../static/css/typo.css">
    <link rel="stylesheet" href="../static/lib/prism/prism.css">
    <link rel="stylesheet" href="../static/lib/tocbot/tocbot.css">
    <link rel="stylesheet" href="../static/css/me.css">

    <title>详情页</title>
</head>
<body  >
    
<!-- 导航-->
    <nav th:replace="_fragments::menu(1)" class="ui inverted attached segment m-padded-tb-mini" >
<div class="ui container">
    <div class="ui inverted secondary stackable menu">
        <h2 class="ui teal header item" > Blog</h2>
        <a href="#" class="m-item  item m-mobile-hide "><i class=" home icon"></i> 首页</a>
        <a href="#" class="m-item item m-mobile-hide"><i class=" idea icon"></i> 分类</a>
        <a href="#" class="m-item item m-mobile-hide"><i class=" tags icon"></i> 标签</a>
        <a href="#" class="m-item item m-mobile-hide"><i class=" clone icon"></i> 归档</a>
        <a href="#" class="m-item item m-mobile-hide"><i class=" info icon"></i> 关于我</a>
        <div class="right item m-mobile-hide">
            <div class="ui icon inverted transparent input">
                <input type="text" placeholder="Search....">
                <i class="search link icon"></i>
            </div> 
        </div>
    </div>
</div>
    <a href="#" class="ui menu toggle black button m-right-top m-mobile-show">
        <i class="sidebar icon"></i>
    </a>
    </nav>
    
<!--中间内容-->

    <div id="waypoint" class="m-container m-padded-tb-large animate__animated animate__fadeIn">

        <div class="ui container">
            <div class="ui top attached segment">
                
                <!--  -->

                <div class="ui horizontal link list">
                        <div class="item">

                     <!--名字和图片获取！！！！ 自己以后再排查bug,实现 -->
                            <img src="../static/image/风铃公主.jpg"  th:src="@{${blog.user.avatar}}" class="ui avatar image" width="90px" height="90px" alt="" srcset="">

                                <div class="content">
                                    <a href="#" class="header">
                                        <span th:value = "${blog.user.username}" >Azea </span>
                                    </a>
                                </div>


                        </div>
                        <div class="item"> 
                            <i class="calendar icon"></i>  <span th:text="${#dates.format(blog.updateTime,'yyyy-MM-dd')}" >2017-10-01</span>
                        </div>

                       <div class="item">
                           <i class="eye icon"></i><span th:text="${blog.views}" > &nbsp; 2384</span>
                        
                       </div>

                    </div>




                        <!--  -->

            </div>




                <div class="ui attached segment" style="height: 620px!important;" >
                <!-- 图片区域  -->    
<img th:src="@{${blog.firstPicture}}"  src="../static/image/1.jpg"  style="height: 620px!important; "  alt="" class="ui rounded centered fluid image">


                 <!-- 图片区域  -->    

                </div>


                <div class="ui attached padded segment">


                       <h2 class="ui center aligned header" th:text = "${blog.title}">关于刻意练习的清单</h2>
                     

                        <div id="content" name="main3content"  class="typo typo-selection js-toc-content m-padded-lr m-padded-tb-large">



                        </div>





                    <!-- 内容  -->

        <!-- 标签-->
        <div class="m-padded-lr m-margin-top">
                <div class="ui basic teal left pointing label" th:each="tag:${blog.tags}">
                   <p th:text="${tag.name}" >方法论 </p>
                </div>
            </div>
           
           
            <!--赞赏 -->
                    <div>
                        <div class="ui center aligned basic segment">
                            <button id="payButton" class="ui orange basic circle button">赞赏</button>
                        </div>

                        <div class="ui payQ flowing popup  transition hidden">
                            <div class="ui orange basic label">
                                <div class="ui images" style="font-size: inherit !important;" >
                                    <div class="image">
                                        <!--二维码 -->
                                        <img src="../static/image/1.jpg" th:src="@{/image/1.jpg}" alt="" style="width: 120px;" class="ui rounded bordered image">
                                        <div>支付宝支付</div>
                                    </div>
                                    <div class="image">
                                        <!--二维码 -->
                                        <img src="../static/image/1.jpg" th:src="@{/image/1.jpg}"alt="" style="width: 120px;" class="ui rounded bordered image">
                                        <div>微信支付</div>
                                    </div>


                                </div>
                            </div>

                        </div>

                    </div>


       

    
                    </div>


 <!--博客信息 -->
                    <div class="ui attached positive message" th:if = "${blog.shareStatement}">
                       
                        
                        <div class="ui middle aligned grid">
<div class="eleven wide column">

    <ui class="  list">

        <li>作者：<span th:text="${blog.user.nickname}" >李先生</span> <a th:href="@{/about}" >(联系作者)</a>  </li>
      
        <li>发表时间 <span th:text="${#dates.format(blog.updateTime,'yyyy-mm-dd HH:mm') }" ></span> 3021-12.02</li>
        <li> 版权声明</li>
        <li>公众号转载</li>
    </ui>

</div>

<div class="five wide column">
<img src="../static/image/1.jpg" th:src="@{/image/1.jpg}" alt="" class="ui right floated rounded bordered image" style="width: 110px;">

</div>

                        </div>
                        

                    </div >


 <!-- 留言区域 -->
                    <div  class="ui bottom attached  message" th:if = ${blog.commentabled} >
                            <!-- 留言区域 -->
                            <div id="comment-container" class="ui teal segment">
 <!--  1111-->


                         <div th:fragment="commentList">
                             <div class="ui threaded comments" style="max-width: 100%;"  >

                                 <h3 class="ui dividing header">评论</h3>
                                 <div class="comment" th:each="comment:${comments}">
                                     <a class="avatar">
                                         <img th:src="@{${comment.avatar}}"  src="../static/image/1.jpg">
                                     </a>
                                     <div class="content">
                                         <a class="author"  >
                                         <span th:text="${comment.nickname}">  Matt </span>

                                             <div class="ui mini basic teal left pointing label m-padded-mini" th:if="${comment.adminComment}">博主 </div>

                                         </a>
                                         <div class="metadata">
<!--                                            th:text="${#data.format(comment.createTime,'yyyy-MM-dd')}" -->
                                             <span class="date" th:text="${#dates.format(comment.createTime,'yyyy-MM-dd')}" >今天下午 5:42</span>
                                         </div>
                                         <div class="text" th:text="${comment.content}">太赞了！ </div>
                                         <div class="actions">
                                             <a class="reply" th:attr ="data-commentid=${comment.id},data-commentnickname=${comment.nickname}" data-commentid="1" data-commentnickname="Matt" onclick="replyComment(this)">回复</a>
                                         </div>
                                     </div>
                                                      <!--    游客评论   -->
                                            <div class="comments" th:if="${#arrays.length(comment.replyComments)}>0" >


                                        <!--       游客评论内容       -->
                                                <div class="comment" th:each="reply:${comment.replyComments}">
                                                    <a class="avatar">
                                                        <img th:src="@{/image/1.jpg}" src="../static/image/1.jpg">
                                                    </a>
                                                    <div class="content">
                                                        <a class="author"  >
                                                         <span th:text="${reply.nickname}" >小红 </span>
                                                            <div class="ui mini basic teal left pointing label m-padded-mini" th:if="${reply.adminComment}">博主 </div>
                                                            &nbsp<span th:text="|@${reply.parentComment.nickname}|" class="m-teal">@小白 </span>
                                                        </a>
                                                        <div class="metadata">
                                                            <!--                                            th:text="${#data.format(comment.createTime,'yyyy-MM-dd')}" -->
                                                            <span class="date" th:text="${#dates.format(reply.createTime,'yyyy-MM-dd')}" >今天下午 5:42</span>
                                                        </div>
                                                        <div class="text" th:text="${reply.content}">太赞了！ </div>
                                                        <div class="actions">
                                                            <a class="reply" th:attr ="data-commentid=${reply.id},data-commentnickname=${reply.nickname}" data-commentid="1" data-commentnickname="Matt" onclick="replyComment(this)">回复</a>
                                                        </div>
                                                    </div>
                                                    <!--                                  游客评论   -->


                                                </div>

                                            </div>
                                     <!--       游客评论        -->
                                 </div>
                                    <!--/* -->
                                 <div class="comment">
                                     <a class="avatar">
                                         <img src="../static/image/1.jpg">
                                     </a>
                                     <div class="content">
                                         <a class="author">Elliot Fu</a>
                                         <div class="metadata">
                                             <span class="date">昨天上午12:30</span>
                                         </div>
                                         <div class="text">
                                             <p>這對我的研究是非常有用.謝謝!</p>
                                         </div>
                                         <div class="actions">
                                             <a class="reply">回复</a>
                                         </div>
                                     </div>
                                     <div class="comments">
                                         <div class="comment">
                                             <a class="avatar">
                                                 <img src="../static/image/1.jpg">
                                             </a>
                                             <div class="content">
                                                 <a class="author">Jenny Hess</a>
                                                 <div class="metadata">
                                                     <span class="date">刚刚</span>
                                                 </div>
                                                 <div class="text">艾略特你永远是多么正确 :) </div>
                                                 <div class="actions">
                                                     <a class="reply">回复</a>
                                                 </div>
                                             </div>
                                         </div>
                                     </div>
                                 </div>
                                 <div class="comment">
                                     <a class="avatar">
                                         <img src="../static/image/1.jpg">
                                     </a>
                                     <div class="content">
                                         <a class="author">Joe Henderson</a>
                                         <div class="metadata">
                                             <span class="date">5 天以前</span>
                                         </div>
                                         <div class="text">老兄，这太棒了。非常感谢。 </div>
                                         <div class="actions">
                                             <a class="reply">回复</a>
                                         </div>
                                     </div>
                                 </div>
                                    <!--*/-->
                             </div>

                         </div>




                                <!--  1111-->
                            </div>
                        <div id="comment-form" class="ui form">

                            <input type="hidden" name="blog_id" th:value="${blog.id}">
                            <input type="hidden" name="parent_comment_id" th:value="-1">
                            <div class="field">
                                <textarea name="content" placeholder="请输入评论~" id="" cols="30" rows="10">  </textarea>
                            </div>

                            <div class="fields">


                                <div class="field m-mobile-wide m-margin-bottom-small">
                                    <div class="ui left icon input">
                                        <i class="user  icon"></i>
                                        <input type="text" name = "nickname" placeholder="姓名" th:value = "${session.user}!=null?${session.user.username}">

                                    </div>
                                </div>

                                <div class="field m-mobile-wide m-margin-bottom-small">
                                    <div class="ui left icon input">
                                        <i class="mail icon"></i>
                                        <input type="text" name = "email" placeholder="邮箱" th:value = "${session.user}!=null?${session.user.email}">
                                    </div>
                                </div>

                                <div class="field m-mobile-wide m-margin-bottom-small">
                                    <button id="commentpost-btn" type="button" class="ui teal button"><i class="edit icon"></i> 发布 </button>
                                </div>


                            </div>
                        </div>


                        </div>

                    



            


        </div>

    </div>
<!--|中间内容|-->

<div id="toolbar" style="display: none;" class="m-fixed m-right-bottom m-padded">

  
<div class="ui vertical icon buttons">
  <button type="button" href="#" class="ui toc teal button">目录</button>
  <a href="#comment-contain" class="ui teal button">留言</a>
  <button class="ui wechat icon button"><i class="weixin icon"></i></button>
  <div id="toTop-button" class="ui teal button"><i class="chevron up icon"></i></div>
</div>

</div>

<!-- 目录-->

<div class="ui toc-container flowing popup  transition hidden" style="width: 250px !important;">

        <ol class="js-toc">

        </ol>


</div>

<!-- 微信二维码-->

<div id="qrcode" class="ui Wechat-Qr flowing popup  transition hidden m-padded-tb-mini" style="width: 130px;" >
  <!-- <img src="./static/image/1.jpg" width="130px" height="120px" alt="" class="ui rounded image"> -->
  </div>






    
    <!-- 底部-->

<footer th:replace="_fragments :: footer"  class="ui inverted vertical segment m-padded-tb-massive">

    <div class="ui center aligned container">

        <div class="ui inverted divided stackable grid">
           
                    <div class="three wide column">
                        <div class=" centered item">
                        <img src="../static/image/1.jpg" class="ui rounded image" style="width: 110px;" alt="" srcset="">
                    </div>
                    </div>

                    <div class="three wide column">
                        <h4 class="ui inverted header  m-text-spaces ">最新博客 </h4>    
                        <div class="ui inverted link list">
                            <a href="#" class="item" >用户故事</a>
                            <a href="#" class="item" >用户故事</a>
                            <a href="#" class="item" >用户故事</a>
                            <a href="#" class="item" >用户故事</a>
                        
                        </div>

                 </div>

                    <div class="three wide column">
                            <h4 class="ui inverted header  m-text-spaces ">联系我 </h4>  
                            <div class="ui inverted link list">
                                    <a href="#" class="item" >Email:1401432910@qq.com</a>
                                    <a href="#" class="item" >QQ:1401432910</a>
                                    
                            </div>
                    </div>

                    <div class="seven wide column">
                            <h4 class="ui inverted header m-text-spaces ">最新博客 </h4>
                            <p>这是关于个人的博客</p>


                     </div>

        </div>
                <div class="ui inverted section divider"></div>
                <p class="m-text-thin m-text-spaces .m-opaciyt-mini ">Copyright ©2020 ABlog Designed by Azea</p>
    </div>


</footer>

<!--/*/<th:block th:replace="_fragments :: script">/*/-->

<script src="../static/js/jquery-3.4.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js"></script>
<script src="../static/lib/prism/prism.js"></script>
<script src="../static/lib/tocbot/tocbot.js"></script>

<script src="../static/lib/jquery.scrollTo.js"></script>
<script src="../static/lib/waypoint/jquery.waypoints.js"></script>
<script src="../static/lib/qrcode/qrcode.js"></script>


<!--/*/</th:block>/*/-->



<script th:inline="javascript">


    var message = [[${blog.content}]];
    $('#content').append(message);
    console.log(message);


</script>


  <script>







    $(".menu.toggle").click(function(){
        $('.m-item').toggleClass('m-mobile-hide');
    });

     $('#payButton').popup({
popup: $('.payQ.popup'),
on : 'click',
position :'bottom center'
    });


    $('.toc.button').popup({
popup: $('.toc-container.popup'),
on : 'click',
position :'left center'
    });
   

    tocbot.init({
  // Where to render the table of contents.
  tocSelector: '.js-toc',
  // Where to grab the headings to build the table of contents.
  contentSelector: '.js-toc-content',
  // Which headings to grab inside of the contentSelector element.
  headingSelector: 'h1, h2, h3',
  // For headings inside relative or absolute positioned containers within content.
  hasInnerContainers: true,
});


$('.wechat').popup({
popup: $('.Wechat-Qr'),
on : 'hover',
position :'left center'
    });


    var qrcode = new QRCode(document.getElementById("qrcode"), {
	text: "http://jindo.dev.naver.com/collie",
	width: 110,
	height: 110,
	colorDark : "#000000",
	colorLight : "#ffffff",
	correctLevel : QRCode.CorrectLevel.H
});

$('#toTop-button').click(function(){
  $(window).scrollTo(0,580);
})


var waypoint = new Waypoint({
  element: document.getElementById('waypoint'),
  handler: function(direction) {
      if(direction == 'down')
      {
$('#toolbar').show(500);
      }
      else
      {
        $('#toolbar').hide(500);
      }
  
  }
})



    $('.ui .form').form({
        fields:{
            nickname:{
                identifier:'nickname',
                rules:[{
                    type:'empty',
                    prompt:'评论：请输入名字'
                }]
            },

            content:{
                identifier:'username',
                rules:[{
                    type:'empty',
                    prompt:'评论：请输入评论内容'
                }]
            },

            email:{
                identifier:'email',
                rules:[{
                    type:'email',
                    prompt:'评论框：请输入邮箱'
                }]
            }
        }

    });


$('#commentpost-btn').click(function () {
   var boo =  $('.ui .form').form('validate form');

   if(boo){
       console.log('校验成功');
       postData();
   }else{
       console.log('校验失败');
   }

});



function postData() {
    $('#comment-container').load( "/comments",{

        "parent_comment_id":$("[name='parent_Comment_id']").val(),
        "blog_id":$("[name='blog_id']").val(),
        "nickname":$("[name='nickname']").val(),
        "email":$("[name='email']").val(),
        "content":$("[name='content']").val()

    },function (responseTxt,statusTxt,xhr){

        $(window).scrollTo($('#comment-container'),500);
        clearContent();

    });




}



function clearContent() {
    $("[name='parent_comment_id']").val(-1);
    $("[name='content']").val('');
}



function replyComment(obj) {
    var commentId = $(obj).data('commentid');
    var commentNickname = $(obj).data('commentnickname');
    $("[name='content']").val("@"+commentNickname).focus();
    $("[name='parent_comment_id']").val(commentId);

    $(window).scrollTo($('#comment-form'),500);
}




    
    </script>


</body>
</html>